<template>
  <div>Hello World: {{ username }}</div>
</template>

<script setup>
import { ref } from 'vue'
const username = ref('ifer')
const sayHi = (name) => {
  username.value = name
}
// script setup 模式下，默认数据对外都是关闭的
defineExpose({
  sayHi
});
</script>